//
//  ProgramFunction.h
//  ConstructGccfg2.0
//
//  Created by Bryce Holton on 12/8/12.
//  Copyright (c) 2012 Bryce Holton. All rights reserved.
//

#ifndef __ConstructGccfg2_0__ProgramFunction__
#define __ConstructGccfg2_0__ProgramFunction__

#include <iostream>
#include "common.h"
#include "ControlFlowGraph.h"

class ProgramFunction
{
public:
    ProgramFunction();
    virtual ~ProgramFunction();
    void SeparateLoopBlocksFromFunctionBlocks();
    
    void SetCfg(ControlFlowGraph &);
    void SetLoop(ControlFlowGraphLoop &);
    void SetSize(int);
    
    ControlFlowGraph *GetCfg();
    vector<ControlFlowGraphLoop *> GetLoops();
    int GetSize();
    
private:
    ControlFlowGraph *cfg;
    vector<ControlFlowGraphLoop *> loops;
    int size;
    
    void SeperateBlockSets();
    void InsertLoopPlaceHolders();
    void SeverBlockConnections();
    void CleanUpBlockLists();
};

#endif /* defined(__ConstructGccfg2_0__ProgramFunction__) */
